<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var num = 0;
        var sum = 0;
        var grade = 0;
        num = prompt('请输入班级人数');
        for (var i = 0; i < num; i++) {
            grade = prompt('请输入第' + (i + 1) + '个人的分数！');
            sum += parseInt(grade);
        }
        // console.log(sum / num);
        alert('平均分是' + sum / num);
    </script>
</head>

<body>

</body>

</html>